﻿using System;
using System.Globalization;
using System.Text;
using Avalonia.Data.Converters;

namespace TCP232.Converters
{
    public class EncodingConverter : IValueConverter
    {
        object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is Encoding encoding)
            {
                return encoding.EncodingName;
            }

            return default;
        }

        object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is Encoding encoding)
            {
                return encoding.EncodingName;
            }

            return default;
        }
    }
}